<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/6/27
 * Time: 10:02
 * Project name: PHPTEST
 * File name: 3.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */

//md5"，"sha256"，"haval160,4"

//21232f297a57a5a743894a0e4a801fc3
echo hash("md5","admin",true).PHP_EOL;
//echo sprintf("%b\n",hash("md5","admin",true));
//echo sprintf("%b\n",0b00101010101010100010);
echo md5("admin").PHP_EOL;
//d033e22ae348aeb5660fc2140aec35850c4da997
echo hash("sha256","admin").PHP_EOL;
//d033e22ae348aeb5660fc2140aec35850c4da997
echo sha1("admin").PHP_EOL;

//3f45bc7cd39d8f61cc99bf63cc3bbb0b  1
//69dd5f62f93e8601a3132c4059759706  2
echo hash_file("md5",__FILE__).PHP_EOL;


foreach (hash_algos() as $val){
	$r = hash($val, "admin", false);
	printf("%-12s %3d %s\n", $val, strlen($r), $r);
}
//md2           32 3e3e6b0e5c1c68644fc5ce3cf060211d
//md4           32 f9d4049dd6a4dc35d40e5265954b2a46
//md5           32 21232f297a57a5a743894a0e4a801fc3
//sha1          40 d033e22ae348aeb5660fc2140aec35850c4da997
//sha224        56 58acb7acccce58ffa8b953b12b5a7702bd42dae441c1ad85057fa70b
//sha256        64 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
//sha384        96 9ca694a90285c034432c9550421b7b9dbd5c0f4b6673f05f6dbce58052ba20e4248041956ee8c9a2ec9f10290cdc0782
//sha512       128 c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec
//ripemd128     32 ed4060702b42311eb4f6c707b11f1999
//ripemd160     40 7dd12f3a9afa0282a575b8ef99dea2a0c1becb51
//ripemd256     64 f87f405941cf41f0c2b5b1939e8a1f9edac7e03c7ceb1491ca5ef467f3bdc6db
//ripemd320     80 960a7b8e2061b3b9eb87e882d0b1953e9a144b1c780c503c0fb2d3d9c6bb1e4febf78b55e1a37780
//whirlpool    128 6a4e012bd9583858a5a6fa15f58bd86a25af266d3a4344f1ec2018b778f29ba83be86eb45e6dc204e11276f4a99eff4e2144fbe15e756c2c88e999649aae7d94
//tiger128,3    32 a2614727bca6549236c470392e1e122a
//tiger160,3    40 a2614727bca6549236c470392e1e122ac135083b
//tiger192,3    48 a2614727bca6549236c470392e1e122ac135083b1ecb30ac
//tiger128,4    32 51c3f5f5d8a8830bc5d8b7ebcb5717df
//tiger160,4    40 51c3f5f5d8a8830bc5d8b7ebcb5717dfb4892d47
//tiger192,4    48 51c3f5f5d8a8830bc5d8b7ebcb5717dfb4892d4766c2a77d
//snefru        64 1cf9fdd774e8fb63bfdaad1baaec2231f7a3de7f6ee42f8d396e39107b968e47
//snefru256     64 1cf9fdd774e8fb63bfdaad1baaec2231f7a3de7f6ee42f8d396e39107b968e47
//gost          64 0e8cd409a23c2e7ad1c5b22b101dfa16720550dc547921c7a099b75c7f405fd4
//gost-crypto   64 a15fd34ab1329ccc4907e554cf43304d1bdb38e0382b63827062dfcb9caad299
//adler32        8 0601020a
//crc32          8 44ce9c5f
//crc32b         8 880e0d76
//fnv132         8 a726eb9a
//fnv1a32        8 34c83614
//fnv164        16 526b63c57e791a7a
//fnv1a64       16 e5cde7fdda328454
//joaat          8 1787a450
//haval128,3    32 4691d973de3ad6d79321d7bff4757b59
//haval160,3    40 21b54cd74fb54c7911a1e7077d5ac4fc90df7228
//haval192,3    48 239169f332a1231516483b7122a23dc90fc026201b7ccedd
//haval224,3    56 0b3fb65f0ca5628e1674cd34f3e56a00e151e2241eb07fafd07c663b
//haval256,3    64 77c33a964e34c9feb8fec535b8632572e570533a47cd68a51fd633ea127c8a37
//haval128,4    32 517e4acb1faae2fd2c6ee83499b3d1cb
//haval160,4    40 f5210b502970f3c8b247966b042d5a188ab52d02
//haval192,4    48 342bb4964c81aa2023fb293311fe1e574e017fb4e237f417
//haval224,4    56 8c3563c0975b44eaa88f48b940fb01715c50703adf5530e13fb7243a
//haval256,4    64 d6293a1eb09b09063261b11a84f404bc79440d7259389711114c1d902018c060
//haval128,5    32 fb409635b4bf06b0de51a8fa2df67a9b
//haval160,5    40 e99609369da737ce0b13f94b765dfd412466faf3
//haval192,5    48 8936e97ee09b3ad72ff8e55005030fb63f40d574516c198a
//haval224,5    56 8df2d3311520301750880025f65534da5207e59633f7f75c3ee0a4f0
//haval256,5    64 c3a309d9403f16a12fd81aa5921ab654f345c36071d9a85ca750e0a76a40ce35

